from .models import Department,DoctorModel
from rest_framework import serializers

class DepartmentSerializer(serializers.ModelSerializer):

  class Meta:
    model = Department
    fields = '__all__'



class HomeDoctorSerializer(serializers.ModelSerializer):
  department = serializers.CharField(source="department.name", read_only=True)
  title = serializers.CharField(source="title.name",read_only=True)
  hospital = serializers.CharField(source="hospital.name",read_only=True)


  class Meta:
    model = DoctorModel
    fields = ['id', 'name', 'avatar','department','title','intro','price','rate','reply','hospital']




